<?php

function GetMicrotime(){
	list($usec, $sec) = explode(" ",microtime());
	return (float)((float)$usec + (float)$sec);
}
$time = GetMicrotime();

include_once( dirname(__FILE__).'/../cform.php' );

$form_fields = 	array(
		Array(
			'title' 	=> 'Текстовое поле',
			'name'		=> 'ftext',
			'type'		=> 'text',
			'value'		=> '',
			'errors' 	=> _nonempty_ | _number_
		),
		Array(
			'title' 	=> 'Email',
			'name'		=> 'femail',
			'type'		=> 'text',
			'value'	 	=> 'dddd',
			'errors' 	=> _nonempty_ | _email_
		),
		Array(
			'title' 	=> 'Список',
			'name'		=> 'flist',
			'type'		=> 'select',
			'value'		=> '2',
			'errors' 	=> _nonempty_,
			'value_list' => array(
				Array('title'=>'bar1', 'value' => 1),
				Array('title'=>'bar2', 'value' => 2, 'SELECTED' => 1),
				Array('title'=>'bar3', 'value' => 3)
			)
		)
);

$vars = array();
$params['ftext'] 	= '123';
$params['femail'] 	= 'sss@ss.ss';
$params['flist']	= '3';

$fh = & new CForm('fname', $form_fields, 1);
$fh->cf_set_values($params, $vars);
if ( $fh->cf_check_form() ){
	print "Все ок!<br><br>";
	$tmpl_src = $fh->cf_gen_template(1);
}else{
	print "Ошибка!!!";
	$vars = array();
	$fh->cf_error_fill_template( $vars );
	print "<pre>".print_r($vars,1);
}
$fh->Free();

print "<br><br>PARSE TIME: ".( GetMicrotime() - $time );

?>